{% extends 'layout.html' %} {% block content %}
<div class="card-body" style="margin-bottom: 5px">
  <div style="display: flex; justify-content: space-between">
    <p style="font-family: 华文仿宋; font-size: 15px; font-weight: 600">
      业务信息
    </p>

    <form method="get">
      {% csrf_token %}
      <div
        class="input-group mb-3"
        style="
          width: 300px;
          height: 35px;
          font-size: 14px;
          font-family: 华文宋体;
          margin-top: -5px;
        "
      >
        <span class="input-group-text" id="basic-addon1">@</span>
        <input
          type="text"
          name="info"
          class="form-control"
          placeholder="Search Business Info"
          aria-label="Username"
          aria-describedby="basic-addon1"
        />
        <button type="submit" class="btn btn-primary">Submit</button>
      </div>
    </form>

    <a href="/business/add/"
      ><button
        type="button"
        class="btn btn-primary"
        style="
          margin-top: -5px;
          width: 100px;
          height: 35px;
          font-size: 14px;
          line-height: 22px;
          font-family: 华文宋体;
        "
      >
        新建业务
      </button></a
    >
  </div>
  <div class="infoList" style="font-size: 14px; font-family: 'Tw Cen MT', 华文宋体,serif">
    <table class="table table-striped table-hover">
      <thead>
        <tr>
          <th scope="col">ID</th>
          <th scope="col">业务名称</th>
          <th scope="col">创建时间</th>
          <th scope="col">价格</th>
          <th scope="col">甲方公司负责人</th>
          <th scope="col">负责人联系电话</th>
          <th scope="col">业务级别</th>
          <th scope="col">业务状态</th>
          <th scope="col">操作</th>
        </tr>
      </thead>
      <tbody style="font-weight: 600; font-size: 14px">
        {% for obj in queryset %}
        <tr>
          <th scope="row" style="line-height: 30px">{{ obj.id }}</th>
          <td style="line-height: 30px">{{ obj.name }}</td>
          <td style="line-height: 30px">{{ obj.create_time|date:"Y-m-d" }}</td>
          <td style="line-height: 30px">{{ obj.price }}</td>
          <td style="line-height: 30px">{{ obj.customer }}</td>
          <td style="line-height: 30px">{{ obj.phone }}</td>
          <td style="line-height: 30px">{{ obj.get_level_display }}</td>
          <td style="line-height: 30px">{{ obj.get_status_display }}</td>
          <td>
            <a href="/business/{{ obj.id }}/update/">
              <button
                type="button"
                class="btn btn-secondary"
                style="font-size: 10px"
              >
                编辑
              </button>
            </a>
            <a href="/business/{{ obj.id }}/delete/">
              <button
                type="button"
                class="btn btn-danger"
                style="font-size: 10px"
              >
                删除
              </button>
            </a>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
<nav aria-label="Page navigation example" style="margin: auto; ">
  <ul class="pagination">
    
    {% if search %} 
    <li class="page-item">
      <a class="page-link" href="?page={{ Pre }}&info={{ info }}" aria-label="Previous">
        <span aria-hidden="true">&laquo;</span>
      </a>
    </li>
    {% for i in page_range %} {% if i == page %}
    <li class="page-item active">
      <a class="page-link" href="?page={{ i }}&info={{ info }}">{{ i }}</a>
    </li>
    {% else %}
    <li class="page-item">
      <a class="page-link" href="?page={{ i }}&info={{ info }}">{{ i }}</a>
    </li>
    {% endif %} {% endfor %} 
    <li class="page-item">
      <a class="page-link" href="?page={{ Next }}&info={{ info }}" aria-label="Next">
        <span aria-hidden="true">&raquo;</span>
      </a>
    </li>
    {% else %} 
    <li class="page-item">
      <a class="page-link" href="?page={{ Pre }}" aria-label="Previous">
        <span aria-hidden="true">&laquo;</span>
      </a>
    </li>
    {% for i in page_range %} {% if i == page %}
    <li class="page-item active">
      <a class="page-link" href="?page={{ i }}">{{ i }}</a>
    </li>
    {% else %}
    <li class="page-item">
      <a class="page-link" href="?page={{ i }}">{{ i }}</a>
    </li>
    {% endif %} {% endfor %}
    <li class="page-item">
      <a class="page-link" href="?page={{ Next }}" aria-label="Next">
        <span aria-hidden="true">&raquo;</span>
      </a>
    </li>
     {% endif %}
  </ul>
</nav>
{% endblock %}
